Skip to content

Netrc format fix pluplus #233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 27, 2025
Merged

Netrc format fix pluplus #233

merged 6 commits into from
Jun 27, 2025

Conversation

pombredanne
Copy link
Member

This is a small PR on top of:

I did regenerate the tests fixtures, and added extra documentation to help regen the tests in the future

@MarcelBochtler ping

MarcelBochtler and others added 6 commits June 18, 2025 12:54
According to the netrc specification (see [1] and [2]), the `machine`
part should not be a full URL, but only a host name.
Before, using the correct netrc format with only a host name did not
work for authentication purposes in Python Inspector.
Fix this by using urllib.parse to find the matching host name.

[1]: https://www.ibm.com/docs/en/aix/7.2.0?topic=formats-netrc-file-format-tcpip
[2]: https://docs.python.org/3/library/netrc.html#netrc.netrc.hosts

Resolves: #176.

Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.com>
Support the fallback to `default` if the user did not set a specific
host name in their netrc file.

Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.com>
Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.com>
In PyPI simple repository format, package URLs typically end with the
package name and should have a trailing slash [1].
To ensure this trailing slash, the some web servers might redirect to
the URL with the trailing slash.
This causes the issue that the BasicAuth credentials are removed from
the request for security reasons.

This was observed with an internal Artifactory repository and adding a
trailing slash to the package_url fixes the issue.

[1]: https://peps.python.org/pep-0503/#specification

Resolves: #127.

Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.com>
These tests use live data from Pypi.org and the package versions have
changed in the resolution. I used these commands:

1. to run all the tests

pytest -vvs

2. to regenerate the expected JSON result files for the failed tests

PYINSP_REGEN_TEST_FIXTURES=yes pytest -vvs --lf

Then I carefully reviewed the diff before committing.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
The README now has improved documentation to run tests and getting
started.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
@pombredanne
Copy link
Member Author

The failure left is an heisenbug.

@pombredanne pombredanne merged commit 3ff5dd5 into main Jun 27, 2025
14 of 16 checks passed
@pombredanne pombredanne deleted the netrc-format-fix-pluplus branch June 27, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants